package tests;
import org.junit.Test;

import cdautils.TriageTag;
import cdautils.TriageTag.*;

import junit.framework.TestCase;

public class TriageTagTest extends TestCase 
{
	private TriageTag tag1, tag2, tag3, newTag;
	private static final String TAG1_BERGEINFO = "bergeinfo1";
	private static final String TAG2_BERGEINFO = "bergeinfo2";
	private static final String TAG3_BERGEINFO = "bergeinfo3";
	private static final TriageCategory TAG1_KAT = TriageCategory.IMMEDIATE;
	private static final TriageCategory TAG2_KAT = TriageCategory.MINOR;
	private static final TriageCategory TAG3_KAT = TriageCategory.DELAYED;
	private static final Integer TAG1_PULS = 51;
	private static final Integer TAG2_PULS = 52;
	private static final Integer TAG3_PULS = 53;
	private TriageTag[] tagHistory;
	private boolean[] diff;
	

	protected void setUp() throws Exception 
	{
		tag1 = new TriageTag();
		tag1.setBergeinformation(TAG1_BERGEINFO);
		tag1.setTriagekategorie(TAG1_KAT);
		tag1.setPuls(TAG1_PULS);
		tag2 = new TriageTag();
		tag2.setBergeinformation(TAG2_BERGEINFO);
		tag2.setTriagekategorie(TAG2_KAT);
		tag1.setPuls(TAG2_PULS);
		tag3 = new TriageTag();
		tag3.setBergeinformation(TAG3_BERGEINFO);
		tag3.setTriagekategorie(TAG3_KAT);
		tag3.setPuls(TAG3_PULS);

		diff = new boolean[26];
		for (int i=0; i<diff.length; i++)
		{
			diff[i]=false;
		}
		tagHistory = new TriageTag[2];
		tagHistory[0] = tag1;
		tagHistory[1] = tag2;
	}

	protected void tearDown() throws Exception 
	{
		super.tearDown();
	}
	
	@Test
	public void integrateChanges_shouldDetermine()
	{
		newTag = TriageTag.integrateChanges(tagHistory, tag3);
		assertEquals(TAG3_KAT, newTag.getTriagekategorie());
		assertEquals(TAG3_PULS, newTag.getPuls());
		assertEquals(TAG3_BERGEINFO, newTag.getBergeinformation());
	}

}
